import django_filters

from apps.myapp.models import StockModel, StockModelInst


class StockModelFilter(django_filters.rest_framework.FilterSet):
    """
    简单序过滤器
    """
    # 通过 lookup_expr 可进行模糊查询，其他配置可自行百度
    name = django_filters.CharFilter(lookup_expr='icontains')

    class Meta:
        model = StockModel
        exclude = ('description', 'creator', 'modifier')

class StockModelInstFilter(django_filters.rest_framework.FilterSet):
    """
    简单序过滤器
    """
    class Meta:
        model = StockModelInst
        exclude = ('description', 'creator', 'modifier')